
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<int> v;
    int i=0;
    while(n--)
    {
        for(int id;cin>>id;)
        {
            v[i++]=id;
        }
    }
    sort(v.begin(),v.end());
    for(i=1;i<v.size();i++)
    {
        if(v[i]-v[i-1]==2)
            break;
    }
    int c=v[i]-1;
    int d=0;
    for(i=1;i<v.size();i++)
    {
        if(v[i]==v[i-1])
        {
            d=v[i];
            break;
        }
    }

    cout<<c<<' '<<d;
    return 0;
}
/*
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> v;
    while (n--) {
        int id;
        while (cin >> id) {
            v.push_back(id);
        }
    }
    sort(v.begin(), v.end());
    int missingId = -1, duplicateId = -1;
    for (int i = 1; i < v.size(); i++) {
        if (v[i] - v[i - 1] == 2) {
            missingId = v[i] - 1;
            break;
        }
    }
    for (int i = 1; i < v.size(); i++) {
        if (v[i] == v[i - 1]) {
            duplicateId = v[i];
            break;
        }
    }
        cout << missingId << ' ' << duplicateId;
    return 0;
}
*/
